<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>用户编辑页面</title>
    <%@ include file="../../../common/meta.jsp" %>
    <link href="${ctx}/css/page/common-win.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/plugins/note/note.css?t=${now}" rel="stylesheet">
    <script src="${ctx}/js/plugins/note/note.js?t=${now}"></script>
    <script src="${ctx}/js/plugins/jQuery.md5.js"></script>
</head>
<style>
    .pull-left.pagination-detail{
        display: none;
    }
    .mySearchBtn{
        padding-top: 14px!important;
        padding-bottom: 14px!important;
        margin-bottom: 0px!important;
    }
</style>
<script>
    var editType = '${type}';
    var oneUserInfo = ${user};
    var userTypeEnumMap = '${userTypeEnumMap}';
    var roleList = '${roleList}';
    var  roleListJson = ${roleListJson};
    var  userType = '${userType}';
    var  searchStr = '${searchStr}';
</script>
<body class="gray-bg">
<div class="myContent" id="vueObj">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>账号信息</h5>
                </div>
                <div class="ibox-content">
                    <h5><i class="fa fa-file-text"></i>  基本信息</h5>
                    <hr>
                    <form class="form-horizontal m-t" id="mainForm">
                        <input type="hidden" id="id" name="id" value="${not empty user ? user.id : ''}">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><span style="color: red">*</span>账号：</label>
                            <div class="col-sm-7">
                                <input type="text" id="userName" isLoginUserName="true" name="userName" placeholder="6-20位数字、字母组合" class="form-control" required maxlength="20" value="${not empty user ? user.userName : ''}" isUserName="true">
                            </div>
                        </div>
                        <c:if test="${type!='info'}">    <div class="form-group">
                            <label class="col-sm-2 control-label">
                                <c:if test="${empty user.id}"><span style="color: red">*</span></c:if>
                                登录密码：</label>
                            <div class="col-sm-7">
                                <input type="password" id="pwd" name="pwd" class="form-control" isUserName="true"
                                <c:if test="${empty user.id}">  required </c:if>
                                        placeholder="6-20位数字、字母组合"
                                       maxlength="20" value="">
                            </div>
                        </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">
                                    <c:if test="${empty user.id}"><span style="color: red">*</span></c:if>确认密码：</label>
                                <div class="col-sm-7">
                                    <input type="password" id="pwd2" name="pwd2" isUserName="true" class="form-control"
                                    <c:if test="${empty user.id}"> required </c:if> equalTo="#pwd"
                                           placeholder="请再次确认密码"
                                           maxlength="20" value="">
                                </div>
                            </div> </c:if>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><span style="color: red">*</span>姓名：</label>
                            <div class="col-sm-7">
                                <input type="text" id="realName" name="realName" class="form-control"
                                      placeholder="请输入真实姓名" required maxlength="32"  value="${not empty user ? user.realName : ''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><span style="color: red">*</span>手机号码：</label>
                            <div class="col-sm-7">
                                <input type="text" id="telephone" isPhoneNo="true" name="telephone" placeholder="请输入手机号" class="form-control" value="${not empty user ? user.telephone : ''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><span style="color: red">*</span>邮箱：</label>
                            <div class="col-sm-7">
                                <input type="text" id="email" name="email" class="form-control"
                                       placeholder="请输入工作电子邮箱账号" required  email="true"  maxlength="50" value="${not empty user ? user.email : ''}">
                            </div>
                        </div>
                        <h5><i class="fa fa-file-text"></i>  权限设置</h5>
                        <hr>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><span style="color: red">*</span>管理员类型：</label>
                            <div class="col-sm-7">
                                <select type="text" id="userType" name="userType" class="form-control" required
                                        <c:if test="${userType == 'super' || userType == 'sysadmin' }">
                                            onchange="changeuserType(this)"
                                        </c:if>
                                >
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${userTypeEnumMap}" var="item">
                                            <option value="${item.key}" ${not empty user && user.userType == item.key? 'selected' : '' } >${item.value}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                                <div class="form-group isv"
                                <c:if test="${not empty user.id && user.userType == 'sysadmin'.toString() }">
                                     style="display: none"
                                </c:if>
                                >
                                <label class="col-sm-2 control-label"><span style="color: red">*</span>合作商户：</label>
                                <div class="col-sm-7">
                                        <c:choose>
                                            <c:when test="${userType =='isvadmin'.toString() || userType =='isvcomm'.toString()}">
                                                <input type="hidden" id="isvPid" name="isvPid" class="form-control"   required value="${not empty user ? user.isvPid : ''}" >
                                                <label style="">${not empty user ? user.isvName : ''}</label>
                                            </c:when>
                                            <c:otherwise>
                                                <div class="input-group">
                                                    <input type="hidden" id="isvPid" name="isvPid" class="form-control"   required value="${not empty user ? user.isvPid : ''}" >
                                                    <input type="text" id="isvName" name="isvName" class="form-control" minlength="1"  required
                                                           <%--value="${not empty user ? user.isvName : ''}"--%>
                                                           v-model="userInfo.isvName" >
                                                    <div class="input-group-btn" style="width:0px!important;border-radius:0px!important">
                                                        <button type="button" class="btn btn-default dropdown-toggle mySearchBtn" data-toggle="dropdown">
                                                            <span class="caret"></span>
                                                        </button>
                                                        <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                        </ul>
                                                    </div>
                                                </div>
                                            </c:otherwise>
                                        </c:choose>
                                </div>
                            </div>
                        <div class="form-group" >
                            <label class="col-sm-2 control-label divNote" style="height: 50pxs"><span style="color: red">*</span>角色：
<c:if test="${type!='info'}"> <button
        type="button"  class="buttonNote btn btn-white btn-xs" onclick="selectRole()">添加角色</button>
</c:if></label>
                            <div class="col-sm-7">
                                  <div class="note" name="roleName" readonly="true">
                                    <c:if test="${not empty user}">
                                      <c:forEach items="${user.roleList}" varStatus="i" var="item" >
                                      <div class="note_lable" name="roleName" value="${item.id}">
                                          <lable>${item.roleName}</lable>
                                          <c:if test="${type!='info'}">
                                              <div  onclick="$(this).parent().remove()">X</div>
                                              <div  class="note_mind"></div>
                                          </c:if>
                                      </div>
                                      </c:forEach>
                                    </c:if>
                                  </div>
                            </div>
                            <label id="roleName-error" class="note_error" style="display: none;"><i class="fa fa-times-circle"></i>  必选</label>
                        </div>
                        <div class="form-group" >
                            <div class="col-sm-4 col-sm-offset-5">
                                <c:if test="${type!='info'}">
                                    <button class="btn btn-primary" type="submit" onclick="doSave()">保存</button>
                                </c:if>
                                <input type="button" class="btn btn-white" onclick="doBack()" value="返回">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctx}/js/plugins/validate/jquery.validate.custom.js?t=20181024"></script>
<script src="${ctx}/js/sys/user/win/editPfUserMgr.js?time=${now}"></script>
<c:if test="${type=='info'}">
    <script src="${ctx}/js/common/myDisabled.js?t=${now}"></script>
</c:if>


<div id="selectRole" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="_modelTitle">选择角色</h4>
            </div>
            <div class="modal-body modal-body-height">
                   <div style="border: 1px solid #e4eaec;-webkit-box-shadow:0px 3px 3px #c8c8c8 ;
-moz-box-shadow:0px 3px 3px #c8c8c8 ;
box-shadow:0px 3px 3px #c8c8c8 ;margin-bottom: 20px">
                        <div class="row" style="margin: 10px!important;">
                            <form action="" id="searchForm">
                                <label class="col-sm-3 text-right control-label">查询角色：</label>  <div class="col-sm-7"><input type="text" class="form-control" id="roleName"
                                                                                                                             onkeydown="if(event.keyCode==13){doRefresh();return false;}"
                                                                                                                             name="roleName"></div><div class="col-sm-2 text-center"><bttton type="button" class="btn btn-white" onclick="doRefresh()">查询</bttton></div>
                            </form>
                         </div>
                  </div>
                <h5><i class="fa fa-table"></i> 角色列表</h5>
                    <div style="border: 1px solid #e4eaec;-webkit-box-shadow:0px 3px 3px #c8c8c8 ;
-moz-box-shadow:0px 3px 3px #c8c8c8 ;
box-shadow:0px 3px 3px #c8c8c8 ;">
                        <table data-toggle="table"   id="dataTable"
                               data-pagination="true"
                               data-side-pagination="server" data-striped="true"
                               data-url="${ctx}/pfRole/getGridDataForCheckbox?t=${now}"
                               data-response-handler="handleServerResult" data-query-params-type=""
                               data-query-params="getParams"
                               data-cache="true" data-page-size="${defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                 <th data-field="checkBx" data-checkbox="true" data-width="20px" ></th>
                                 <th data-field="roleName"data-align="center" >角色名称</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                <%--<c:forEach items="${roleList}" varStatus="i" var="item" >--%>
                    <%--<lable><input type="checkbox" name="roleBox" value="${item.id}"--%>
                    <%--<c:forEach items="${roleListJson}" varStatus="j" var="cell" >--%>
                        <%--<c:if test="${item.id eq cell}">checked="checked"</c:if>--%>
                    <%--</c:forEach>--%>
                                  <%--text="${item.roleName}">${item.roleName}</lable>--%>
                <%--</c:forEach>--%>
            </div>
            <div class="modal-footer text-center" style="text-align: center;">
                <button class="btn btn-primary" onclick="clickRole()">确定</button>
                <button class="btn btn-white" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>

</body>
</html>
